/*
 * Created on Sep 21, 2006
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package neuro.uu.se.utils;

import java.util.concurrent.Callable;

public class Worker implements Callable{
	
	WorkStrategy workLoad;
	Object object;
	
	public Worker(){
		object = null;
		workLoad = null;
	}
	
	public Worker(WorkStrategy workLoad, Object object){
		this();
		this.workLoad = workLoad;
		this.object = object;
	}
	
	public void setMethod(WorkStrategy workLoad){
		this.workLoad = workLoad;
	}
	
	public void setCollection(Object object){
		this.object = object;
	}
	
	public Object getWorkObject(){
		return object;
	}
	
	public Object call() throws Exception{
		if ( object == null)
			return null;
		return workLoad.perform(object);
	}
}
